package com.example.prison.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.prison.entity.AttendanceList;
import com.example.prison.entity.vo.AttendanceListVO;
import com.example.prison.mapper.AttendanceListMapper;
import com.example.prison.service.AttendanceListService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author jiang
* @description 针对表【attendance_list】的数据库操作Service实现
* @createDate 2023-04-11 17:09:50
*/
@Service
public class AttendanceListServiceImpl extends ServiceImpl<AttendanceListMapper, AttendanceList>
    implements AttendanceListService {

    @Autowired
    private AttendanceListMapper attendanceListMapper;

    @Override
    public PageInfo<AttendanceList> getAttendanceList(int pageNumber, int pageSize) {
        PageHelper.startPage(pageNumber, pageSize);
        return new PageInfo<>(attendanceListMapper.getAttendanceList());
    }

    @Override
    public PageInfo<AttendanceListVO> getInfoList(int pageNumber, int pageSize, String beginTime, String endTime) {
        PageHelper.startPage(pageNumber, pageSize);
        return new PageInfo<>(attendanceListMapper.getInfoList(beginTime,endTime));
    }

    @Override
    public void addAttendanceRecord(AttendanceList attendanceList) {
        attendanceListMapper.addAttendanceRecord(attendanceList);
    }

    @Override
    public void delete(Integer[] ids) {
        attendanceListMapper.deleteAttendanceList(ids);
    }

    @Override
    public PageInfo<AttendanceListVO> getListByTime(int pageNumber, int pageSize, String beginTime, String endTime) {
        PageHelper.startPage(pageNumber, pageSize);
        return new PageInfo<>(attendanceListMapper.getListByTime(beginTime, endTime));
    }

    @Override
    public AttendanceList getById(Integer id) {
        return attendanceListMapper.getById(id);
    }

    @Override
    public PageInfo<AttendanceList> getBySNOrderByTime(String SN, String beginTime, String endTime) {
        return new PageInfo<>(attendanceListMapper.getBySNOrderByTime(SN, beginTime, endTime));
    }

    @Override
    public AttendanceList getBySNAndTimeAndPType(String SN, String beginTime, String endTime, String ptype) {
        return attendanceListMapper.getBySNAndTimeAndPType(SN, beginTime, endTime, ptype);
    }


}




